Skip to content

Added versioning configuration for COS buckets in CSI driver #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Prachi03510
Copy link

Adds support for enabling versioning on COS buckets via the IBM COS CSI driver

if val, ok := secretMap["BucketVersioning"]; ok && val != "" {
enable := strings.ToLower(strings.TrimSpace(val))
if enable != "true" && enable != "false" {
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("Invalid BucketVersioning value in secret: %s. Must be 'true' or 'false'", val))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please log secret name as well her.
status.Error(codes.InvalidArgument, fmt.Sprintf("Invalid BucketVersioning value in secret: %s. Value set %s. Must be 'true' or 'false'", secretName, val))

fmt.Sprintf("Invalid BucketVersioning value in storage class: %s. Must be 'true' or 'false'", val))
}
BucketVersioning = enable
klog.Infof("BucketVersioning set via storage class: %s", BucketVersioning)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klog.Infof("BucketVersioning value that will be set via storage class params: %s", BucketVersioning)

@@ -48,6 +48,7 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
kpRootKeyCrn string
pvcName string
pvcNamespace string
BucketVersioning string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bucketVersioning

return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("Invalid BucketVersioning value in secret: %s. Must be 'true' or 'false'", val))
}
BucketVersioning = enable
klog.Infof("BucketVersioning set via secret: %s", BucketVersioning)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klog.Infof("BucketVersioning value that will be set via secret: %s", BucketVersioning)

@@ -441,6 +479,7 @@ func parseCustomSecret(secret *v1.Secret) map[string]string {
iamEndpoint string
cosEndpoint string
locationConstraint string
BucketVersioning string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bucketVersioning

@@ -479,6 +518,10 @@ func parseCustomSecret(secret *v1.Secret) map[string]string {
locationConstraint = string(bytesVal)
}

if bytesVal, ok := secret.Data["BucketVersioning"]; ok {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bucketVersioning -> small case in the start to comply with how other params are set in the secret.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants